<template>
  <div>
    <!-- <div style="margin-left: 20px; margin-right: 20px" class="bg_write" v-loading="loading"></div> -->
    <tableComponents
      :pagination="{ currentPage, pageSize, total: list.all_num }"
      :isHaveAdd="false"
	  :searchData="userSearchData"
      :orderStatus="acIndex"
      :isHaveExport="false"
    >
      <template v-slot:headRight>
        <div class="fx head-right-icon" @click="add_equity">
          <p><i class="el-icon-upload"></i>&nbsp;&nbsp;添加权益包</p>
        </div> 
        <!-- <div class="fx head-right-icon" @click="export_goods">
          <p><i class="el-icon-upload"></i>&nbsp;&nbsp;导出发货单</p>
        </div>
        <div class="fx head-right-icon" @click="$router.push('/index/order/import')">
          <p><i class="el-icon-upload"></i>&nbsp;&nbsp;导入运单</p>
        </div>
        <div class="fx head-right-icon" @click="export_danpin">
          <p><i class="el-icon-upload"></i>&nbsp;&nbsp;导出单品</p>
        </div>-->
      </template>
    </tableComponents>

    <xzRiderwork
      v-if="riderworkShow"
      :show="riderworkShow"
      :extract_id="riderSelectForm.rider_extract_id"
      :isAll="false"
      showType="list"
      @sendShop="getSelectRider"
      @isshow="riderworkShow = false"
    ></xzRiderwork>
    <xzReceivingMaster
      v-if="receivingMasterShow"
      :show="receivingMasterShow"
      :extract_id="receivingMasterForm.rider_extract_id"
      :isAll="false"
      showType="list"
      @sendShop="getSelectMaster"
      @isshow="receivingMasterShow = false"
    ></xzReceivingMaster>


    <!-- 添加权益包 -->
    <el-dialog
      :close-on-click-modal="false"
      title="添加权益包"
      :lock-scroll="true"
      :visible.sync="equity_show"
      class="tc size_13"
      width="400px"
    >
      <el-form class="mar_top" label-width="60px">
        <el-form-item label="金额">
          <el-col :span="24">
            <el-input
              v-model="equity_money"
              placeholder="请输入金额"
            ></el-input>
          </el-col>
        </el-form-item>
        <el-form-item label="用户名">
          <el-col :span="24">
            <el-input
              v-model="equity_username"
              placeholder="请输入用户名"
            ></el-input>
          </el-col>
        </el-form-item>

        <el-form-item>
          <el-button
            :loading="$store.state.isLoading"
            type="info"
            @click="cancel_equity"
            >取消</el-button
          >
          <el-button
            :loading="$store.state.isLoading"
            type="primary"
            @click="confirm_equity"
            >确定</el-button
          >
        </el-form-item>
      </el-form>
    </el-dialog>
  </div>
</template>
<script>
import { mapState } from "vuex";
import { orderSearchData } from "@/assets/js/searchData/searchData"; //引入搜索的数据
import xzRiderwork from "@/components/currency/xz_riderwork.vue";
import xzReceivingMaster from "@/components/currency/xz_receivingmaster.vue";
export default {
  data() {
    return {
      redList: [],
      receivingMasterForm: {},
      receivingMasterShow: false,
      riderSelectForm: {},
      riderworkShow: false,
      userSearchData: orderSearchData,
      mail_form: {},
      mail_show: false,
      sel_mail: {},
      company: [],
      dialogTableVisible: false,
      dialogRewardVisible: false,
      dialogPrintVisible: false,
      show: false,
      myshow: false,
      loading: false,
      list: [],
      allPage: 0,
      allNum: 0,
      pageSize: 10,
      currentPage: 1,
      editId: "",
      multipleSelection: "",
      arr: [],
      visible: false,
      clickNum: 1,
      updataIndex: "",
      form: {
        id: "",
        oid: "",
        mail_oid: "",
        mail_time: "",
        remark: "",
        kdn_order_code: "",
        mail_type: "0",
        mail_courier: "",
        mail_courier_en: "",
      },
      moneylist: [],
      val: "",
      index: "",
      vo: "",
      searchAll: {
        status: this.$route.query.status,
        oid: this.$route.query.oid || "",
        sku_id: this.$route.query.sku_id,
      },
      iskdlwnjk: false,
      payList: [],
      types_option: [],
      acIndex: "",
      changePriceShow: false,
      changePriceInfo: {},
      mail_courier: {}, //选择的物流公司
      checkList: [],
      checkAll: false,
      psxx_show: false,
      psxx_info: false,
      xxx_info: {},
      collection: [],
      show_xxx: false,
      xxx_pay: "",
      acTypes: "42",
      prodType: [
        { iden: "", title: "所有订单" },
        { iden: "未支付", title: "待付款" },
        { iden: "配货中", title: "待发货" },
        { iden: "已发货", title: "待收货" },
        { iden: "已完成", title: "交易完成" },
        { iden: "退货中", title: "退货中" },
      ],
      offline_show: false,
      offline_img: "",
      equity_show: false,
      equity_money: "",
      equity_username: "",
    };
  },
  components: {
    xzRiderwork,
    xzReceivingMaster,
  },
  methods: {
    // 添加权益包
    add_equity() {
      this.equity_show = true;
      console.log("添加权益包");
    },
    // 取消添加
    cancel_equity() {
      this.equity_show = false;
      this.equity_money = "";
      this.equity_username = "";
    },
    // 确认添加
    confirm_equity() {
      if (!this.equity_money) {
        this.$message({
          type: "error",
          message: "请输入金额",
        });
        return;
      }

      if (isNaN(this.equity_money)) {
        this.$message({
          type: "error",
          message: "请输入正确金额",
        });
        return;
      }

      if (!this.equity_username) {
        this.$message({
          type: "error",
          message: "请输入用户名",
        });
        return;
      }

      this.$api.getUser
        .add_equity({
          money: this.equity_money,
          username: this.equity_username,
        })
        .then((res) => {
          if (res.data.status == 1 && res.data.code == 200) {
            this.$fnc.alertSuccess({
              text: "提交成功",
              url: this.$router.back(-1),
            });
            this.equity_show = false;

            // 这里要加一下刷新列表数据
          } else {
            this.$fnc.alertError(res.data.code_desc, res.data.result);
          }
        });
    },

    closeOrderInfo(id) {
      var taht = this;
      this.$confirm("是否确认取消订单?", "确认", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          var params = {
            id: id,
          };
          taht.$api.getDz.close_order_list(params).then((res) => {
            if (res.data.code === 200) {
              taht.reload();
              taht.$message({
                type: "success",
                message: "取消订单成功!",
              });
            } else {
              this.$message.error(res.data.result);
            }
          });
        })
        .catch(() => {
          taht.$message({
            type: "info",
            message: "已取消",
          });
        });
    },
    confirmWrite(item) {
      let taht = this;
      this.$confirm("是否确认核销?", "确认", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          var params = {
            id: item.id,
          };
          taht.$api.getUser.complete_order_write(params).then((res) => {
            if (res.data.code === 200) {
              taht.reload();
              taht.$message({
                type: "success",
                message: "确认核销成功!",
              });
            } else {
              console.log(res);
            }
          });
        })
        .catch(() => {
          taht.$message({
            type: "info",
            message: "已取消",
          });
        });
    },
    getSelectMaster(val) {
      let params = {
        id: this.receivingMasterForm.id,
        receiving_uid: val.id,
      };
      this.$api.getReceiving.select_order_master(params).then((res) => {
        if (res.data.code === 200) {
          this.reload();
          this.$message({
            type: "success",
            message: res.data.result,
          });
        } else {
          this.$message({
            type: "info",
            message: res.data.result,
          });
        }
      });
    },
    openSelectMaster(obj) {
      this.receivingMasterForm.id = obj.id;
      this.receivingMasterForm.receiving_uid = obj.receiving_uid;
      this.current = "xz_receivingmaster";
      this.receivingMasterShow = true;
    },
    getSelectRider(val) {
      let params = {
        id: this.riderSelectForm.id,
        rider_uid: val.id,
      };
      this.$api.getRider.selectOrderRider(params).then((res) => {
        if (res.data.code === 200) {
          this.reload();
          this.$message({
            type: "success",
            message: res.data.result,
          });
        } else {
          this.$message({
            type: "info",
            message: res.data.result,
          });
        }
      });
    },
    openSelectRider(item) {
      this.riderSelectForm = {
        id: item.id,
        rider_extract_id: item.rider_extract_id,
      };
      this.riderworkShow = true;
    },
    returnedBtn(oid) {
      this.$store.commit("addbreadcrumbs", {
        title: "退换货申请",
        url: `/index/order/returned?oid=${oid}`,
      });
      this.$router.push({
        path: "/index/order/returned",
        query: { oid: oid },
      });
    },
    xxxBtn() {
      var taht = this;
      this.$confirm("是否确认已经支付?", "确认", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          var params = {
            id: this.xxx_info.id,
            pay: this.xxx_pay,
          };
          taht.$api.getShops.confirm_pay(params).then((res) => {
            if (res.data.code === 200) {
              this.show_xxx = false;
              taht.reload();
              taht.$message({
                type: "success",
                message: "确认成功!",
              });
            } else {
              console.log(res);
            }
          });
        })
        .catch(() => {
          taht.$message({
            type: "info",
            message: "已取消",
          });
        });
    },
    jhcxtj(val) {
      this.$api.getStation.supply_chain_order({ id: val.id }).then((res) => {
        if (res.data.code == 200) {
          this.$fnc.alertSuccess("提交成功");
        } else {
          this.$fnc.alertError(res.data.code_desc, res.data.result);
        }
      });
    },
    jdpsxx(val) {
      this.$api.getStation
        .jingdong_orderTrack({ id: val.jd_oid })
        .then((res) => {
          if (res.data.code == 200) {
            this.psxx_show = true;
            this.psxx_info = res.data.result;
          } else {
            this.$fnc.alertError(res.data.code_desc, res.data.result);
          }
        });
    },
    handleCheckAllChange(val) {
      this.checkList = val ? this.list.data : [];
    },
    pldydzmd() {
      if (this.checkList.length == 0) {
        this.$fnc.alertError("请选择要打印的订单");
        return;
      }
      var checkList = JSON.parse(JSON.stringify(this.checkList));
      var arr = [];
      for (let i of checkList) {
        arr.push(i.id);
      }
      var params = {
        id_str: arr.join("@"),
      };
      this.$api.getShops.order_batch_prints(params).then((res) => {
        if (res.data.code == 200) {
          this.$fnc.alertSuccess("打印成功");
        } else {
          this.$fnc.alertError(res.data.code_desc, res.data.result);
        }
      });
    },
    copy_gift(id) {
      var dom = document.getElementById(id);
      var span = dom.innerText;
      var oInput = document.createElement("input");
      oInput.value = span;
      document.body.appendChild(oInput);
      oInput.select();
      document.execCommand("Copy");
      oInput.className = "oInput";
      oInput.style.display = "none";
      this.$message.success("复制成功");
    },
    subChangePrice() {
      this.$api.getShops
        .set_order_modify_price(this.changePriceInfo)
        .then((res) => {
          if (res.data.status == 1 && res.data.code == 200) {
            this.changePriceShow = false;
            this.$fnc.alertSuccess({ text: res.data.result });
            this.getPage();
          } else {
            this.$fnc.alertError(res.data.code_desc, res.data.result);
          }
        });
    },
    changePayPrice(po, vo) {
      this.changePriceShow = true;
      this.changePriceInfo = {
        id: vo.id,
        pid: po.id,
        types: "1",
        money: "",
        p_title: po.title,
      };
    },
    showPhase(val) {
      let routeData = this.$router.resolve({
        path: "/index/groupbuy/phase",
        query: { gid: val.gid },
      });
      window.open(routeData.href, "_blank");
    },
    export_danpin() {
      var params = {};
      params = this.searchAll;
      if (this.$route.path.indexOf("supplierorder") >= 0) {
        params.is_supplier = 1;
      }
      if (this.$route.path.indexOf("chain_order") >= 0) {
        params.is_chain = 1;
      }
      this.$fnc.postExcelFile(params, "/api/admin/export/order_product");
    },
    export_goods() {
      var params = {};
      params = this.searchAll;
      if (this.$route.path.indexOf("supplierorder") >= 0) {
        params.is_supplier = 1;
      }
      if (this.$route.path.indexOf("chain_order") >= 0) {
        params.is_chain = 1;
      }
      this.$fnc.postExcelFile(params, "/api/admin/export_order/order_goods");
    },
    getInfos(index) {
      this.acTypes = index;
      this.searchAll.types = index;
      if (this.acTypes == "") {
        this.prodType = [
          { iden: "", title: "所有订单" },
          { iden: "未支付", title: "待付款" },
          { iden: "配货中", title: "待发货" },
          { iden: "已发货", title: "待收货" },
          { iden: "已完成", title: "交易完成" },
          { iden: "退货中", title: "退货中" },
        ];
      } else {
        for (let i of this.types_option) {
          if (i.index == index) {
            this.prodType = i.data;
            if (this.prodType[0]) {
              this.acIndex = this.prodType[0].iden || "";
            }
            break;
          }
        }
      }
      this.getStatus(this.searchAll.status);
    },
    getInfo(iddex) {
      this.acIndex = iddex;
      if (this.$route.query.action == 34) {
        this.searchAll.status = "";
        this.searchAll.jh_status = iddex;
      } else {
        this.searchAll.status = iddex;
      }
      this.getStatus(this.searchAll.status);
    },
    get_ordertype() {
      var params = {};
      if (this.$route.path.indexOf("supplierorder") >= 0) {
        params.is_supplier = 1;
      }
      this.$api.getShops.get_orderoption(params).then((res) => {
        if (res.data.code == 200) {
          var arr = [];
          let key = {};
          for (var i in res.data.result) {
            var obj = {};
            obj.index = i;
            obj.title = res.data.result[i].title;
            obj.data = res.data.result[i].data;

            arr.push(obj);
            if (
              this.$route.query.action &&
              this.$route.query.action == obj.index
            ) {
              key = obj;
            }
          }
          // this.$store.commit("setTypesOption", arr);
          this.types_option = arr;
          if (key.index) {
            this.acTypes = key.index;
            this.prodType = key.data;
          }
          // else if (this.types_option[0]) {
          //   this.acTypes = this.types_option[0].index;
          //   this.prodType = this.types_option[0].data;
          // }
          if (this.prodType[0]) {
            this.acIndex = this.prodType[0].iden || "";
          }
          console.log(this.acIndex);
        }
      });
    },
    getPayList() {
      var params = {};
      params.parent_id = "";
      this.$api.getConfig.payLists(params).then((res) => {
        if (res.data.code == 200 && res.data.status == 1 && res.data.result) {
          this.payList = res.data.result;
          this.$store.commit("setPayList", res.data.result);
        }
      });
    },
    getPrintreceipt(vo) {
      // this.$router.push({ path: "/printorder", query: { id: vo.id } });
      this.$api.getShops.printer_ticket({ id: vo.id }).then((res) => {
        if (res.data.code == 200) {
          if (res.data.result) {
            this.$swal("打印成功！", "正在打印中", "success");
          } else {
            let routeData = this.$router.resolve({
              path: "/printreceipt",
              query: { id: vo.id },
            });
            window.open(routeData.href, "_blank");
          }
        } else {
          let routeData = this.$router.resolve({
            path: "/printreceipt",
            query: { id: vo.id },
          });
          window.open(routeData.href, "_blank");
        }
      });
    },
    copy_btn(str) {
      var oInput = document.createElement("input");
      oInput.value = str;
      document.body.appendChild(oInput);
      oInput.select();
      document.execCommand("Copy");
      oInput.className = "oInput";
      oInput.style.display = "none";
      this.$message({
        showClose: true,
        message: "复制成功",
        type: "success",
      });
    },
    open_mail(item) {
      this.mail_show = true;
      if (item.types == 43) {
        this.$api.getSupplier.doudian_mail({ id: item.id }).then((res) => {
          if (res.data.code == 200) {
            this.mail_form = res.data.result.mail || {};
            this.mail_form.mail_courier = res.data.result.mail_courier;
          }
        });
      } else {
        this.$api.getShops.get_mail({ id: item.id }).then((res) => {
          if (res.data.code == 200) {
            this.mail_form = res.data.result.mail || {};
            this.mail_form.mail_courier = res.data.result.mail_courier;
          }
        });
      }
    },
    mail_change(value) {
      this.$set(this.mail_courier, "title", value.title);
      this.$set(this.mail_courier, "title_en", value.title_en);
      this.form.mail_courier = value.title;
      this.form.mail_courier_en = value.title_en;
    },
    comfirmPay(val) {
      if (val.types == 37) {
        this.xxx_info = val;
        this.$api.getStation.collection_lists_all({}).then((res) => {
          if (res.data.code == 200) {
            this.collection = res.data.result;
            this.show_xxx = true;
          }
        });
      } else {
        var taht = this;
        this.$confirm("是否确认已经支付?", "确认", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        })
          .then(() => {
            taht.$api.getShops.confirm_pay({ id: val.id }).then((res) => {
              if (res.data.code === 200) {
                taht.reload();
                taht.$message({
                  type: "success",
                  message: "确认成功!",
                });
              } else {
                console.log(res);
              }
            });
          })
          .catch(() => {
            taht.$message({
              type: "info",
              message: "已取消",
            });
          });
      }
    },
    copy_tjm($event) {
      var dom = $event.currentTarget.parentElement.previousElementSibling;
      var span = dom.innerText;
      var oInput = document.createElement("input");
      oInput.value = span;
      document.body.appendChild(oInput);
      oInput.select();
      document.execCommand("Copy");
      oInput.className = "oInput";
      oInput.style.display = "none";
      this.$fnc.alertSuccess("复制成功");
    },
    went_user(tid) {
      let routeData = this.$router.resolve({
        path: "/index/user/user_info",
        query: { id: tid },
      });
      window.open(routeData.href, "_blank");
    },
    getOrderSearch(obj) {
      this.searchAll = obj;
      obj.status = this.acIndex;
      this.getNewsAll(obj);
    },
    getStatus(sta) {
      this.searchAll.status = sta;
      this.getNewsAll(this.searchAll);
    },
    check_kdn() {
      var data = { sid: this.vo.sid };

      this.$api.getUser.checkKdn(data).then((res) => {
        if (res.data.code != 200) {
          this.$fnc.alertError("请先到设置中配置快递鸟接口");
          this.form.mail_type = "0";
          if (this.vo) {
            this.vo.mail_type = "0";
          }

          return false;
        }
      });
    },
    imgError(item) {
      if (!item) {
        return require("../../assets/img/default_head.png");
      }
      if (item.indexOf("http") >= 0 || item.indexOf("api") >= 0) {
        return item;
      } else {
        return "/api/" + item;
      }
    },
    toSupplierDetila(id) {
      let routeData = this.$router.resolve({
        path: "/index/user/user_info",
        query: { id: id },
      });
      window.open(routeData.href, "_blank");
    },
    getOrderInfo(vo) {
      // this.$router.push({
      //   path: "/index/order/addorder",
      //   query: { id: vo.id }
      // });
      let routeData = this.$router.resolve({
        path: "/index/order/addorder",
        query: { id: vo.id },
      });
      window.open(routeData.href, "_blank");
    },

    getPrintInfo(vo) {
      // this.$router.push({ path: "/printorder", query: { id: vo.id } });
      let routeData = this.$router.resolve({
        path: "/printorder",
        query: { id: vo.id },
      });
      window.open(routeData.href, "_blank");
    },
    getPrintTemplate(vo) {
      let routeData = this.$router.resolve({
        path: "/printtemplate",
        query: { id: vo.id },
      });
      window.open(routeData.href, "_blank");
    },
    getNewsAll(data) {
      this.loading = true;
      data = data || {};
      var params = {};
      var sid = this.$route.query.sid || "";
      params = data;
      params.sid = sid;
      if (this.$route.path.indexOf("supplierorder") >= 0) {
        params.is_supplier = 1;
      }
      if (this.$route.path.indexOf("chain_order") >= 0) {
        params.is_chain = 1;
      }
      if (this.$route.query.receiving_uid) {
        params.receiving_uid = this.$route.query.receiving_uid;
      }

      params.types = this.acTypes;
      // if (this.$route.query.action) {
      //   params.types = this.$route.query.action;
      // }
      // if (!data.status && this.$route.query.action == 19) {
      //   params.status = this.acIndex;
      // }
      this.$api.getUser.getLockMoneyList(params).then((res) => {
        if (res.data.code == 200 && res.data.status == 1) {
          this.list = res.data.result;
        } else {
          this.$fnc.alertError(res.data.code_desc, res.data.result);
        }

        this.loading = false;
      });
    },
    handleSizeChange(val) {
      this.getNewsAll("", val);
      var params = this.searchAll;
      params.page = "";
      params.page_size = val;
      this.getNewsAll(params);
      this.pageSize = val;
      // console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      var path = this.$route.path + "?page=" + val;
      if (this.$route.query.action) {
        path = path + "&action=" + this.$route.query.action;
      }
      this.$router.push(path);
    },
    handleSwitch(val, id) {
      //审核
      var params = {};
      params["id"] = id;
      val == true ? (params["is_check"] = 1) : (params["is_check"] = 0);
      this.$api.getUser.msgCheck(params).then((res) => {
        // this.getNewsAll();
      });
    },
    handleSelectionChange(val) {
      //多选框赋值
      this.multipleSelection = val;
    },
    showEditDialog(index, vo) {
      this.mail_courier = {
        title: vo.mail_courier || this.company[0].title,
        title_en: vo.mail_courier_en || this.company[0].title_en,
      };
      var mail_courier = this.form.mail_courier;
      var mail_courier_en = this.form.mail_courier_en;
      this.index = index;
      this.form = vo;
      this.form.mail_time = this.$fnc.vuetime(vo.mail_time);

      if (!this.isMailOpen || !this.isOpenKdn) {
        this.form.mail_type = "0";
      }

      if (
        vo.mail_courier == "" ||
        vo.mail_courier == null ||
        vo.mail_courier == undefined
      ) {
        this.form.mail_courier = mail_courier;
        this.form.mail_courier_en = mail_courier_en;
      }

      if (vo.types == 43) {
        this.$api.getSupplier.doudian_mail_company({}).then((res) => {
          if (res.data.code == 200) {
            this.company = res.data.result;
            this.dialogTableVisible = true;
            this.clickNum++;
          }
        });
      } else {
        this.dialogTableVisible = true;
        this.clickNum++;
      }
    },
    showRewardDialog(index, oid) {
      this.dialogRewardVisible = true;
      var data = {};
      data["oid"] = oid;
      this.$api.getUser.orderMoneyList(data).then((res) => {
        if (res.data.status == 1 && res.data.code == 200) {
          this.moneylist = res.data.result;
        } else {
          this.$fnc.alertError(res.data.code_desc, res.data.result);
        }
      });

      this.$api.getDz.get_red_all(data).then((res) => {
        if (res.data.status == 1 && res.data.code == 200) {
          this.redList = res.data.result;
        } else {
          this.$fnc.alertError(res.data.code_desc, res.data.result);
        }
      });
    },
    reload(id) {
      var params = this.searchAll;
      params.page = this.$route.query.page || 1;
      params.page_size = this.pageSize;
      this.getNewsAll(params);
      this.currentPage = Number(this.$route.query.page) || 1;
    },
    subForm() {
      var data = {};
      data["id"] = this.form.id;

      data["mail_courier"] = this.form.mail_courier;
      data["mail_courier_en"] = this.form.mail_courier_en;
      data["mail_oid"] = this.form.mail_oid;

      var str = this.form.mail_time;
      str = str.toString();
      var s1 = str.substring(0, str.length - 3);

      data["mail_time"] = s1;
      data["remark"] = this.form.remark;

      data["mail_type"] = this.form.mail_type;

      if (this.form.types == 43) {
        this.$api.getSupplier.doudian_edit_send(data).then((res) => {
          this.dialogTableVisible = false;

          if (res.data.status == 1 && res.data.code == 200) {
            this.form.kdn_order_code = res.data.result.kdn_order_code;
            this.form.mail_oid = res.data.result.mail_oid;
            this.$fnc.alertSuccess({ text: "添加成功" });
            this.getPage();

            this.visible = false;
          } else {
            this.$fnc.alertError(res.data.code_desc, res.data.result);
          }
        });
      } else {
        this.$api.getUser.orderMailSave(data).then((res) => {
          this.dialogTableVisible = false;

          if (res.data.status == 1 && res.data.code == 200) {
            this.form.kdn_order_code = res.data.result.kdn_order_code;
            this.form.mail_oid = res.data.result.mail_oid;
            this.$fnc.alertSuccess({ text: "添加成功" });
            this.getPage();

            this.visible = false;
          } else {
            this.$fnc.alertError(res.data.code_desc, res.data.result);
          }
        });
      }
    },
    getPage() {
      var params = this.searchAll;
      if (this.$route.query.action) {
        params.types = this.$route.query.action;
      }
      params.page = this.$route.query.page || 1;
      params.page_size = this.pageSize;
      this.getNewsAll(params);
      this.currentPage = Number(this.$route.query.page) || 1;
    },
    setReserve(index, vo) {
      var data = {};
      data["id"] = vo.id;
      this.$api.getUser.orderServeSave(data).then((res) => {
        if (res.data.status == 1 && res.data.code == 200) {
          this.$fnc.alertSuccess({ text: "开始服务成功" });
          this.getPage();
        } else {
          this.$fnc.alertError(res.data.code_desc, res.data.result);
        }
      });
    },
  },
  created() {
    this.get_ordertype();
    this.getPayList();
    this.getNewsAll(this.searchAll);
    this.$api.getSupplier.get_mail_company({}).then((res) => {
      if (res.data.code == 200) {
        this.company = res.data.result;
        // if (res.data.result != undefined && res.data.result.length > 0) {
        //   this.form.mail_courier = this.company[0].title;
        //   this.form.mail_courier_en = this.company[0].title_en;
        // }
      }
    });
  },
  mounted() {
    var kdlwnjk =
      JSON.parse(localStorage.getItem("limit")).kdlwnjk &&
      JSON.parse(localStorage.getItem("limit")).kdlwnjk.is_open
        ? JSON.parse(localStorage.getItem("limit")).kdlwnjk.is_open
        : 0 || 0;
    kdlwnjk == 1 ? (this.iskdlwnjk = true) : (this.iskdlwnjk = false);
  },
  computed: {
    ...mapState({
      plugin: (state) => state.plugin,
      isMailOpen: (state) => state.isMailOpen,
    }),
    isOpenKdn() {
      if (this.plugin.kdlwnjk && this.plugin.kdlwnjk.is_open == 1) {
        return true;
      } else {
        return false;
      }
    },
    mailType() {
      return this.form.mail_type;
    },
    ifOpenqsps() {
      if (
        typeof this.plugin.qsps != undefined &&
        this.plugin.qsps &&
        this.plugin.qsps.is_open == "1"
      ) {
        console.log(111);
        return true;
      } else {
        console.log(222);
        return false;
      }
    },
    // prodType() {
    //   if (this.$route.query.action == 4) {
    //     return [
    //       { iden: "所有订单", title: "所有订单" },
    //       { iden: "拼团成功", title: "拼团成功" },
    //       { iden: "拼团失败", title: "拼团失败" },
    //     ];
    //   } else if (this.$route.query.action == 19) {
    //     return [
    //       { iden: "拼购订单", title: "拼购订单" },
    //       { iden: "拼购进行中", title: "拼购进行中" },
    //       { iden: "拼购成功", title: "拼购成功" },
    //       { iden: "拼购失败", title: "拼购失败" },
    //     ];
    //   } else if (this.$route.query.action == 21) {
    //     return [
    //       { iden: "所有订单", title: "所有订单" },
    //       { iden: "未支付", title: "待付款" },
    //       { iden: "已发货", title: "待入住" },
    //       { iden: "已完成", title: "交易完成" },
    //     ];
    //   } else if (this.$route.query.action == 34) {
    //     return [
    //       { iden: "所有订单", title: "所有订单" },
    //       { iden: "0", title: "未提交" },
    //       { iden: "1", title: "提交失败" },
    //       { iden: "2", title: "已提交" },
    //       { iden: "3", title: "交易成功" },
    //       { iden: "4", title: "已发货" },
    //       { iden: "5", title: "已收货" },
    //       { iden: "6", title: "订单取消" },
    //     ];
    //   } else {
    //     return [
    //       { iden: "所有订单", title: "所有订单" },
    //       { iden: "未支付", title: "待付款" },
    //       { iden: "配货中", title: "待发货" },
    //       { iden: "已发货", title: "待收货" },
    //       // { iden: "用户自提", title: "用户自提" },
    //       { iden: "已完成", title: "交易完成" },
    //       { iden: "退货中", title: "退货中" },
    //       // { iden: "待领单", title: "待领单", show: !this.ifOpenqsps },
    //       // { iden: "配送中", title: "配送中", show: !this.ifOpenqsps },
    //     ];
    //   }
    // },
  },
  watch: {
    $route() {
      this.getPage();
    },
    acTypes(val) {
      this.getInfos(val);
    },
    acIndex(val) {
      this.getInfo(val);
    },
  },
};
</script>

<style lang="less" scoped>
.el-col {
  border-radius: 4px;
}
.image {
  /*border: 1px solid #efefef;*/
  /*width: 60px;*/
  /*height: 60px;*/
  /*margin: 0 14px;*/
}
.bg-purple {
  background: #ffffff;
}
.bg-purple-light {
  background: #f5f5f5;
}
.grid-content {
  background: #f5f5f5;
  height: 31px;
  line-height: 31px;
  font-size: 12px;
  color: #aaa;
  overflow: hidden;
  border: 1px solid #e5e5e5;
}
.grid-content2 {
  float: left;
  font-size: 14px;
  min-height: 100px;
}
.order_num {
  color: #333;
}
.line-balck {
  border-right: 1px solid #e5e9f2;
  border-bottom: 1px solid #e5e9f2;
}
.line-left {
  border-left: 1px solid #e5e9f2;
}
.gray-font {
  color: #aaa;
  cursor: pointer;
}
.gray_set:hover {
  color: #333 !important;
}
.pay_info {
  display: block;
  margin: 0 auto;
  margin-top: 5px;
  padding-top: 5px;
  border-top: solid 1px #e5e5e5;
  line-height: 19px;
  overflow: hidden;

  width: 95px;
}
.pd_5 {
  padding-top: 0px;
  padding-left: 20px;
  padding-right: 20px;
}
.v_c {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
}
.order_list .big_table {
  width: 100%;
}
.big_table_td {
  vertical-align: top;
  min-height: 100px;
  padding: 25px 15px 15px;
  border-right: 1px solid #e5e9f2;
  border-bottom: 1px solid #e5e9f2;
  font-size: 12px;
  color: #666;
  line-height: 20px;
}
.uname {
  cursor: pointer;
}
.uname:hover a {
  color: red !important;
}

.small_table {
  width: 100%;
  min-height: 100px;
  border: none;
}
.small_table tr {
  border-bottom: 1px #e5e9f2 solid;
  display: flex;
  align-items: center;
}
.small_table tr:last-child {
  border-bottom: none;
}

.small_table td {
  padding: 10px;
  line-height: 20px;
  color: #333;
  font-size: 12px;
  flex: 1;
}

.li_1 {
  width: 40%;
  border-left: 1px solid #e5e9f2;
}
.li_2 {
  width: 15%;
}
.li_3 {
  width: 12%;
}
.li_4 {
  width: 18%;
}
.li_5 {
  width: 15%;
}
.order_details {
  color: #333;
  line-height: 22px;
}
.table_img {
  width: 100px;
  height: 100px;
  display: flex;
  justify-content: center;
  align-content: center;
}
.table_img img {
  width: 100%;
}
.fixed-info {
  span {
    display: inline-block;
    width: 60px;
  }
}
.mail_box {
  width: 100%;
  height: 600px;
  overflow-y: scroll;
}

.gift_use {
  border: 1px solid #1aad19;
  color: #1aad19;
  padding: 2px 5px;
}
.gift_use1 {
  border: 1px solid red;
  color: red;
  padding: 2px 5px;
}
.activity_list_user {
  width: 100%;
  padding-left: 50px;
  > div {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: center;
    > div {
      margin-right: 15px;
    }
  }
}
.order_hyzq {
  padding-left: 30px;
  padding-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: flex-start;
  > div {
    width: 33.33%;
    > span:nth-of-type(1) {
      font-weight: bold;
    }
  }
}
</style>
